*** Stata 15 reproduction code for

*Mader, Matthias & Harald Schoen.
*What a difference an event can make: The European refugee crisis, party competition, and voters’ responses in Germany
*West European Politics


*** Figure 5: Effects of change in absolute distance to the CDU and of pre-crisis immigration attitude on change in vote choice and party identification
***********************************************************************************************************************************************************

use "DATA_wide.dta", clear

*** Left panel of Figure 5
	
 	matrix w7w11 = J(4,3,.) // 5 rows, 3 columns 
 	matrix w7w13 = J(4,3,.) // 5 rows, 3 columns 
 	matrix w7w16 = J(4,3,.) // 5 rows, 3 columns

	foreach i in 11 13 16 {
	logit from7_wunion`i' rdiff6_adist_cdu`i' rdiff6_adist_csu`i' rdiff6_wadist_cdu`i' rdiff6_wadist_csu`i'
	estimate store m_from7_wunion`i'
	margins, dydx(rdiff6_adist_cdu`i' rdiff6_adist_csu`i')
	matrix list r(table)
	mat r=r(table)
	matrix w7w`i'[1, 1] = r[1,1]
	matrix w7w`i'[1, 2] = r[5,1]
	matrix w7w`i'[1, 3] = r[6,1]
	matrix list w7w`i'
	}
	
	foreach i in 11 13 16 {
	logit from7_iunion`i' rdiff6_adist_cdu`i' rdiff6_adist_csu`i' rdiff6_wadist_cdu`i' rdiff6_wadist_csu`i'
	estimate store m_from7_iunion`i'
	margins, dydx(rdiff6_adist_cdu`i' rdiff6_adist_csu`i')
	mat r=r(table)
	matrix w7w`i'[2, 1] = r[1,1]
	matrix w7w`i'[2, 2] = r[5,1]
	matrix w7w`i'[2, 3] = r[6,1]
	matrix list w7w`i'	
	}
	
	foreach i in 11 13 16{
	logit toward7_wafd`i' rdiff6_adist_cdu`i' rdiff6_adist_csu`i' rdiff6_wadist_cdu`i' rdiff6_wadist_csu`i'
	estimate store m_toward7_wafd`i'
	margins, dydx(rdiff6_adist_cdu`i' rdiff6_adist_csu`i')
	matrix list r(table)
	mat r=r(table)
	matrix w7w`i'[3, 1] = r[1,1]
	matrix w7w`i'[3, 2] = r[5,1]
	matrix w7w`i'[3, 3] = r[6,1]
	matrix list w7w`i'
	}
	foreach i in 11 13 16 {
	logit toward7_iafd`i' rdiff6_adist_cdu`i' rdiff6_adist_csu`i' rdiff6_wadist_cdu`i' rdiff6_wadist_csu`i'
	estimate store m_toward7_iafd`i'
	margins, dydx(rdiff6_adist_cdu`i' rdiff6_adist_csu`i')
	mat r=r(table)
	matrix w7w`i'[4, 1] = r[1,1]
	matrix w7w`i'[4, 2] = r[5,1]
	matrix w7w`i'[4, 3] = r[6,1]
	matrix list w7w`i'	
	}
	
*** Create left panel of Figure 5
	grstyle init
	grstyle set imesh, horizontal
	coefplot (matrix(w7w11[,1]), ci((w7w11[,2] w7w11[,3])) msymbol(circle) mcolor(gs6) mlcolor(gs0) msize(vlarge) ciopts(recast(rbar) barwidth(0.03) color(gs0)) offset(0.16)) ///
			 (matrix(w7w13[,1]), ci((w7w13[,2] w7w13[,3])) msymbol(circle) mcolor(gs13) mlcolor(gs0) msize(vlarge) ciopts(recast(rbar) barwidth(0.03) color(gs0)) offset(0.00)) ///
			 (matrix(w7w16[,1]), ci((w7w16[,2] w7w16[,3])) msymbol(circle) mcolor(gs16) mlcolor(gs0) msize(vlarge) ciopts(recast(rbar) barwidth(0.03) color(gs0)) offset(-0.16)) ///
			, /// 
			coeflabels(r1="{&Delta} vote choice, away" r2="{&Delta} ID, away" r3="{&Delta} vote choice, toward" r4="{&Delta} ID, toward" ,labsize(large) labcolor(gs0)) ///
			xscale(range(-.2 .8)) xlabel(-.2 (.2) .8, noticks labsize(large) labcolor(gs0))  xmtick(none) ///
			legend(order(2 "w4-w7" 4 "w4-w8" 6 "w4-w9" ) position(6) col(4)  size(large) symxsize(5) region(lcolor(gs16)))  /// 
			plotregion(color(gs15)) ///
			graphregion(margin(-5 0 -5 0)) ysize(2.5) xsize(3.5)  /// scale(.8)
			title("Effects of {&Delta} absolute distance to CDU on...", size(large) color(gs0)) ///
			headings(r1 = "CDU/CSU" r3 = "AfD", nogap) /// labgap(-10)
			name(fig5a, replace)
	

	
	
*** Appendix: Regression tables for Figure 5 (part 1)
********************************************************

	esttab m_from7_wunion11 m_from7_wunion13 m_from7_wunion16 using Tables_Figure5_left_union1.rtf, replace /// 
		stats(r2_p N , fmt(%9.2g) labels("McFadden's R2" "N")) ///
		cells(b(star fmt(2)) se(par fmt(2) )) ///
		mtitles("w4-w7" "w4-w8" "w4-w9") ///
		varlabels ///
			 (rdiff6_adist_cdu11 "Change in absolute immigration distance to the CDU (w3-w7)" ///
			 rdiff6_adist_csu11 "Change in absolute immigration distance to the CSU (w3-w7)" ///
			 rdiff6_adist_cdu13 "Change in absolute immigration distance to the CDU (w3-w8)" ///
			 rdiff6_adist_csu13 "Change in absolute immigration distance to the CSU (w3-w8)" ///
			 rdiff6_adist_cdu16 "Change in absolute immigration distance to the CDU (w3-w9)" ///
			 rdiff6_adist_csu16 "Change in absolute immigration distance to the CSU (w3-w9)" ///
			 rdiff6_wadist_cdu11 "Change in absolute welfare distance to the CDU (w3-w7)" ///
			 rdiff6_wadist_csu11 "Change in absolute welfare distance to the CSU (w3-w7)" ///
			 rdiff6_wadist_cdu13 "Change in absolute welfare distance to the CDU (w3-w8)" ///
			 rdiff6_wadist_csu13 "Change in absolute welfare distance to the CSU (w3-w8)" ///
			 rdiff6_wadist_cdu16 "Change in absolute welfare distance to the CDU (w3-w9)" ///
			 rdiff6_wadist_csu16 "Change in absolute welfare distance to the CSU (w3-w9)" ///
			 _cons "Constant") ///
		title("Table: Regression results for change away from CDU/CSU vote choice") ///
		addnotes("Notes: Reported are logits with standard errors in parentheses. *: p<0,05, **: p<0,01, ***: p<0,001.") /// 
		varwidth(40) modelwidth(15)

	esttab m_from7_iunion11 m_from7_iunion13 m_from7_iunion16 using Tables_Figure5_left_union2.rtf, replace /// 
		stats(r2_p N , fmt(%9.2g) labels("McFadden's R2" "N")) ///
		cells(b(star fmt(2)) se(par fmt(2) )) ///
		mtitles("w4-w7" "w4-w8" "w4-w9") ///
		varlabels ///
			 (rdiff6_adist_cdu11 "Change in absolute immigration distance to the CDU (w3-w7)" ///
			 rdiff6_adist_csu11 "Change in absolute immigration distance to the CSU (w3-w7)" ///
			 rdiff6_adist_cdu13 "Change in absolute immigration distance to the CDU (w3-w8)" ///
			 rdiff6_adist_csu13 "Change in absolute immigration distance to the CSU (w3-w8)" ///
			 rdiff6_adist_cdu16 "Change in absolute immigration distance to the CDU (w3-w9)" ///
			 rdiff6_adist_csu16 "Change in absolute immigration distance to the CSU (w3-w9)" ///
			 rdiff6_wadist_cdu11 "Change in absolute welfare distance to the CDU (w3-w7)" ///
			 rdiff6_wadist_csu11 "Change in absolute welfare distance to the CSU (w3-w7)" ///
			 rdiff6_wadist_cdu13 "Change in absolute welfare distance to the CDU (w3-w8)" ///
			 rdiff6_wadist_csu13 "Change in absolute welfare distance to the CSU (w3-w8)" ///
			 rdiff6_wadist_cdu16 "Change in absolute welfare distance to the CDU (w3-w9)" ///
			 rdiff6_wadist_csu16 "Change in absolute welfare distance to the CSU (w3-w9)" ///
			 _cons "Constant") ///
		title("Table: Regression results for change away from CDU/CSU party identification") ///
		addnotes("Notes: Reported are logits with standard errors in parentheses. *: p<0,05, **: p<0,01, ***: p<0,001.") /// 
		varwidth(40) modelwidth(15)

	esttab m_toward7_wafd11 m_toward7_wafd13 m_toward7_wafd16 using Tables_Figure5_left_afd1.rtf, replace /// 
		stats(r2_p N , fmt(%9.2g) labels("McFadden's R2" "N")) ///
		cells(b(star fmt(2)) se(par fmt(2) )) ///
		mtitles("w4-w7" "w4-w8" "w4-w9") ///
		varlabels ///
			 (rdiff6_adist_cdu11 "Change in absolute immigration distance to the CDU (w3-w7)" ///
			 rdiff6_adist_csu11 "Change in absolute immigration distance to the CSU (w3-w7)" ///
			 rdiff6_adist_cdu13 "Change in absolute immigration distance to the CDU (w3-w8)" ///
			 rdiff6_adist_csu13 "Change in absolute immigration distance to the CSU (w3-w8)" ///
			 rdiff6_adist_cdu16 "Change in absolute immigration distance to the CDU (w3-w9)" ///
			 rdiff6_adist_csu16 "Change in absolute immigration distance to the CSU (w3-w9)" ///
			 rdiff6_wadist_cdu11 "Change in absolute welfare distance to the CDU (w3-w7)" ///
			 rdiff6_wadist_csu11 "Change in absolute welfare distance to the CSU (w3-w7)" ///
			 rdiff6_wadist_cdu13 "Change in absolute welfare distance to the CDU (w3-w8)" ///
			 rdiff6_wadist_csu13 "Change in absolute welfare distance to the CSU (w3-w8)" ///
			 rdiff6_wadist_cdu16 "Change in absolute welfare distance to the CDU (w3-w9)" ///
			 rdiff6_wadist_csu16 "Change in absolute welfare distance to the CSU (w3-w9)" ///
			 _cons "Constant") ///
		title("Table: Regression results for change toward AfD vote choice") ///
		addnotes("Notes: Reported are logits with standard errors in parentheses. *: p<0,05, **: p<0,01, ***: p<0,001.") /// 
		varwidth(40) modelwidth(15)
			
	esttab m_toward7_iafd11 m_toward7_iafd13 m_toward7_iafd16 using Tables_Figure5_left_afd2.rtf, replace /// 
		stats(r2_p N , fmt(%9.2g) labels("McFadden's R2" "N")) ///
		cells(b(star fmt(2)) se(par fmt(2) )) ///
		mtitles("w4-w7" "w4-w8" "w4-w9") ///
		varlabels ///
			 (rdiff6_adist_cdu11 "Change in absolute immigration distance to the CDU (w3-w7)" ///
			 rdiff6_adist_csu11 "Change in absolute immigration distance to the CSU (w3-w7)" ///
			 rdiff6_adist_cdu13 "Change in absolute immigration distance to the CDU (w3-w8)" ///
			 rdiff6_adist_csu13 "Change in absolute immigration distance to the CSU (w3-w8)" ///
			 rdiff6_adist_cdu16 "Change in absolute immigration distance to the CDU (w3-w9)" ///
			 rdiff6_adist_csu16 "Change in absolute immigration distance to the CSU (w3-w9)" ///
			 rdiff6_wadist_cdu11 "Change in absolute welfare distance to the CDU (w3-w7)" ///
			 rdiff6_wadist_csu11 "Change in absolute welfare distance to the CSU (w3-w7)" ///
			 rdiff6_wadist_cdu13 "Change in absolute welfare distance to the CDU (w3-w8)" ///
			 rdiff6_wadist_csu13 "Change in absolute welfare distance to the CSU (w3-w8)" ///
			 rdiff6_wadist_cdu16 "Change in absolute welfare distance to the CDU (w3-w9)" ///
			 rdiff6_wadist_csu16 "Change in absolute welfare distance to the CSU (w3-w9)" ///
			 _cons "Constant") ///
		title("Table: Regression results for change toward AfD party identification") ///
		addnotes("Notes: Reported are logits with standard errors in parentheses. *: p<0,05, **: p<0,01, ***: p<0,001.") /// 
		varwidth(40) modelwidth(15)
						
*** Right panel of Figure 5

	matrix w1w7 = J(4,3,.) // 5 rows, 3 columns 
	matrix w7w9 = J(4,3,.) // 5 rows, 3 columns 
	matrix w7w10 = J(4,3,.) // 5 rows, 3 columns 
	matrix w7w17 = J(4,3,.) // 5 rows, 3 columns
	
	*From CDU/CSU, vote
	logit from1_wunion7 immi1 diff1_immi7 welfare1 diff1_welfare7
	estimate store m_from1_wunion7
	margins, dydx(immi1)
	matrix list r(table)
	mat r=r(table)
	matrix w1w7[1, 1] = r[1,1]
	matrix w1w7[1, 2] = r[5,1]
	matrix w1w7[1, 3] = r[6,1]
	
	logit from7_wunion9 immi7 diff7_immi9 welfare7 diff7_welfare10  // for welfare distance, w7 --> w10 is used
	estimate store m_from7_wunion9
	margins, dydx(immi7)
	matrix list r(table)
	mat r=r(table)
	matrix w7w9[1, 1] = r[1,1]
	matrix w7w9[1, 2] = r[5,1]
	matrix w7w9[1, 3] = r[6,1]

	foreach i in 10 17 {
	logit from7_wunion`i' immi7 diff7_immi`i' welfare7 diff7_welfare`i'
	estimate store m_from7_wunion`i'
	margins, dydx(immi7)
	matrix list r(table)
	mat r=r(table)
	matrix w7w`i'[1, 1] = r[1,1]
	matrix w7w`i'[1, 2] = r[5,1]
	matrix w7w`i'[1, 3] = r[6,1]
	matrix list w7w`i'
	}	

	*From CDU/CSU, PI
	logit from1_iunion7 immi1 diff1_immi7 welfare1 diff1_welfare7
	estimate store m_from1_iunion7
	margins, dydx(immi1)
	matrix list r(table)
	mat r=r(table)
	matrix w1w7[2, 1] = r[1,1]
	matrix w1w7[2, 2] = r[5,1]
	matrix w1w7[2, 3] = r[6,1]

	logit from7_iunion9 immi7 diff7_immi9 welfare7 diff7_welfare10  // for welfare distance, w7 --> w10 is used
	estimate store m_from7_iunion9
	margins, dydx(immi7)
	matrix list r(table)
	mat r=r(table)
	matrix w7w9[2, 1] = r[1,1]
	matrix w7w9[2, 2] = r[5,1]
	matrix w7w9[2, 3] = r[6,1]
	
	foreach i in 10 17 {
	logit from7_iunion`i' immi7 diff7_immi`i' welfare7 diff7_welfare`i'
	estimate store m_from7_iunion`i'
	margins, dydx(immi7)
	matrix list r(table)
	mat r=r(table)
	matrix w7w`i'[2, 1] = r[1,1]
	matrix w7w`i'[2, 2] = r[5,1]
	matrix w7w`i'[2, 3] = r[6,1]
	matrix list w7w`i'
	}		
		
	*Toward AfD, vote
	logit toward1_wafd7 immi1 diff1_immi7 welfare1 diff1_welfare7
	estimate store m_toward1_wafd7
	margins, dydx(immi1)
	matrix list r(table)
	mat r=r(table)
	matrix w1w7[3, 1] = r[1,1]
	matrix w1w7[3, 2] = r[5,1]
	matrix w1w7[3, 3] = r[6,1]
	
	logit toward7_wafd9 immi7 diff7_immi9 welfare7 diff7_welfare10  // for welfare distance, w7 --> w10 is used
	estimate store m_toward7_wafd9
	margins, dydx(immi7)
	matrix list r(table)
	mat r=r(table)
	matrix w7w9[3, 1] = r[1,1]
	matrix w7w9[3, 2] = r[5,1]
	matrix w7w9[3, 3] = r[6,1]

	foreach i in 10 17 {
	logit toward7_wafd`i' immi7 diff7_immi`i' welfare7 diff7_welfare`i'
	estimate store m_toward7_wafd`i'
	margins, dydx(immi7)
	matrix list r(table)
	mat r=r(table)
	matrix w7w`i'[3, 1] = r[1,1]
	matrix w7w`i'[3, 2] = r[5,1]
	matrix w7w`i'[3, 3] = r[6,1]
	matrix list w7w`i'
	}	

	*Toward AfD, PI
	logit toward1_iafd7 immi1 diff1_immi7 welfare1 diff1_welfare7
	estimate store m_toward1_iafd7
	margins, dydx(immi1)
	matrix list r(table)
	mat r=r(table)
	matrix w1w7[4, 1] = r[1,1]
	matrix w1w7[4, 2] = r[5,1]
	matrix w1w7[4, 3] = r[6,1]

	logit toward7_iafd9 immi7 diff7_immi9 welfare7 diff7_welfare10  // for welfare distance, w7 --> w10 is used
	estimate store m_toward7_iafd9
	margins, dydx(immi7)
	matrix list r(table)
	mat r=r(table)
	matrix w7w9[4, 1] = r[1,1]
	matrix w7w9[4, 2] = r[5,1]
	matrix w7w9[4, 3] = r[6,1]

	foreach i in 10 17 {
	logit toward7_iafd`i' immi7 diff7_immi`i' welfare7 diff7_welfare`i'
	estimate store m_toward7_iafd`i'
	margins, dydx(immi7)
	matrix list r(table)
	mat r=r(table)
	matrix w7w`i'[4, 1] = r[1,1]
	matrix w7w`i'[4, 2] = r[5,1]
	matrix w7w`i'[4, 3] = r[6,1]
	matrix list w7w`i'
	}	

***	Create right panel of Figure 5
	grstyle init
	grstyle set imesh, horizontal 
	coefplot (matrix(w1w7[,1]), ci((w1w7[,2] w1w7[,3])) msymbol(circle) mcolor(gs0) mlcolor(gs0) msize(vlarge) ciopts(recast(rbar) barwidth(0.03) color(gs0)) offset(0.25)) ///
			 (matrix(w7w9[,1]), ci((w7w9[,2] w7w9[,3])) msymbol(circle) mcolor(gs6) mlcolor(gs0) msize(vlarge) ciopts(recast(rbar) barwidth(0.03) color(gs0)) offset(0.08)) ///
			 (matrix(w7w10[,1]), ci((w7w10[,2] w7w10[,3])) msymbol(circle) mcolor(gs13) mlcolor(gs0) msize(vlarge) ciopts(recast(rbar) barwidth(0.03) color(gs0)) offset(-.08)) ///
			 (matrix(w7w17[,1]), ci((w7w17[,2] w7w17[,3])) msymbol(circle) mcolor(gs16) mlcolor(gs0) msize(vlarge) ciopts(recast(rbar) barwidth(0.03) color(gs0)) offset(-0.25)) ///
			, /// 
			coeflabels(r1="{&Delta} vote choice, away" r2="{&Delta} ID, away" r3="{&Delta} vote choice, toward" r4="{&Delta} ID, toward" ,labsize(large) labcolor(gs0)) ///
			xscale(range(-.2 .8)) xlabel(-.2 (.2) .8, noticks labsize(large) labcolor(gs0)) xmtick(none) ///
			legend(order(2 "w1-w4" 4 "w4-w5" 6 "w4-w6" 8 "w4-w10") position(6) col(4)  size(large) symxsize(5) region(lcolor(gs16)))  /// 
			plotregion(color(gs15)) ///
			graphregion(margin(-5 0 -5 0)) ysize(2.5) xsize(3.5)  /// scale(.8)
			title("Effects of prior immigration attitude on...", size(large) color(gs0)) ///
			headings(r1 = "CDU/CSU" r3 = "AfD", nogap) /// labgap(-10)
			name(fig5b, replace)

	
*** Appendix: Regression tables for Figure 5 (part 2)
********************************************************

	esttab m_from1_wunion7 m_from7_wunion9 m_from7_wunion10 m_from7_wunion17 using Tables_Figure5_right_union1.rtf, replace /// 
		stats(r2_p N , fmt(%9.2g) labels("McFadden's R2" "N")) ///
		cells(b(star fmt(2)) se(par fmt(2) )) ///
		mtitles("w1-w4" "w4-w5" "w4-w6" "w4-w10") ///
		varlabels ///
			(immi1 "Immigration attitude (w1)" ///
			 diff1_immi7 "Change in immigration attitude (w1-w4)" ///
			 immi7  "Immigration attitude (w4)" ///
			 diff7_immi9  "Change in immigration attitude (w4-w5)" ///
			 diff7_immi10  "Change in immigration attitude (w4-w6)" ///
			 diff7_immi17  "Change in immigration attitude (w4-w10)" ///
			 welfare1 "Welfare attitude (w1)" ///
			 diff1_welfare7 "Change in welfare attitude (w1-w4)" ///
			 welfare7  "Welfare attitude (w4)" ///
			 diff7_welfare10  "Change in welfare attitude (w4-w6)" ///
			 diff7_welfare17  "Change in welfare attitude (w4-w10)" ///
			 _cons "Constant") ///
		title("Table: Regression results for change away from CDU/CSU vote choice") ///
		addnotes("Notes: Reported are logits with standard errors in parentheses. *: p<0,05, **: p<0,01, ***: p<0,001.") /// 
		varwidth(40) modelwidth(15)	
	
	esttab m_from1_iunion7 m_from7_iunion9 m_from7_iunion10 m_from7_iunion17 using Tables_Figure5_right_union2.rtf, replace /// 
		stats(r2_p N , fmt(%9.2g) labels("McFadden's R2" "N")) ///
		cells(b(star fmt(2)) se(par fmt(2) )) ///
		mtitles("w1-w4" "w4-w5" "w4-w6" "w4-w10") ///
		varlabels ///
			(immi1 "Immigration attitude (w1)" ///
			 diff1_immi7 "Change in immigration attitude (w1-w4)" ///
			 immi7  "Immigration attitude (w4)" ///
			 diff7_immi9  "Change in immigration attitude (w4-w5)" ///
			 diff7_immi10  "Change in immigration attitude (w4-w6)" ///
			 diff7_immi17  "Change in immigration attitude (w4-w10)" ///
			 welfare1 "Welfare attitude (w1)" ///
			 diff1_welfare7 "Change in welfare attitude (w1-w4)" ///
			 welfare7  "Welfare attitude (w4)" ///
			 diff7_welfare10  "Change in welfare attitude (w4-w6)" ///
			 diff7_welfare17  "Change in welfare attitude (w4-w10)" ///
			 _cons "Constant") ///
		title("Table: Regression results for change away from CDU/CSU party identification") ///
		addnotes("Notes: Reported are logits with standard errors in parentheses. *: p<0,05, **: p<0,01, ***: p<0,001.") /// 
		varwidth(40) modelwidth(15)	
	
	esttab m_toward1_wafd7 m_toward7_wafd9 m_toward7_wafd10 m_toward7_wafd17 using Tables_Figure5_right_afd1.rtf, replace /// 
		stats(r2_p N , fmt(%9.2g) labels("McFadden's R2" "N")) ///
		cells(b(star fmt(2)) se(par fmt(2) )) ///
		mtitles("w1-w4" "w4-w5" "w4-w6" "w4-w10") ///
		varlabels ///
			(immi1 "Immigration attitude (w1)" ///
			 diff1_immi7 "Change in immigration attitude (w1-w4)" ///
			 immi7  "Immigration attitude (w4)" ///
			 diff7_immi9  "Change in immigration attitude (w4-w5)" ///
			 diff7_immi10  "Change in immigration attitude (w4-w6)" ///
			 diff7_immi17  "Change in immigration attitude (w4-w10)" ///
			 welfare1 "Welfare attitude (w1)" ///
			 diff1_welfare7 "Change in welfare attitude (w1-w4)" ///
			 welfare7  "Welfare attitude (w4)" ///
			 diff7_welfare10  "Change in welfare attitude (w4-w6)" ///
			 diff7_welfare17  "Change in welfare attitude (w4-w10)" ///
			 _cons "Constant") ///
		title("Table: Regression results for change toward AfD vote choice") ///
		addnotes("Notes: Reported are logits with standard errors in parentheses. *: p<0,05, **: p<0,01, ***: p<0,001.") /// 
		varwidth(40) modelwidth(15)

	esttab m_toward1_iafd7 m_toward7_iafd9 m_toward7_iafd10 m_toward7_iafd17 using Tables_Figure5_right_afd2.rtf, replace /// 
		stats(r2_p N , fmt(%9.2g) labels("McFadden's R2" "N")) ///
		cells(b(star fmt(2)) se(par fmt(2) )) ///
		mtitles("w1-w4" "w4-w5" "w4-w6" "w4-w10") ///
		varlabels ///
			(immi1 "Immigration attitude (w1)" ///
			 diff1_immi7 "Change in immigration attitude (w1-w4)" ///
			 immi7  "Immigration attitude (w4)" ///
			 diff7_immi9  "Change in immigration attitude (w4-w5)" ///
			 diff7_immi10  "Change in immigration attitude (w4-w6)" ///
			 diff7_immi17  "Change in immigration attitude (w4-w10)" ///
			 welfare1 "Welfare attitude (w1)" ///
			 diff1_welfare7 "Change in welfare attitude (w1-w4)" ///
			 welfare7  "Welfare attitude (w4)" ///
			 diff7_welfare10  "Change in welfare attitude (w4-w6)" ///
			 diff7_welfare17  "Change in welfare attitude (w4-w10)" ///
			 _cons "Constant") ///
		title("Table: Regression results for change toward AfD party identification") ///
		addnotes("Notes: Reported are logits with standard errors in parentheses. *: p<0,05, **: p<0,01, ***: p<0,001.") /// 
		varwidth(40) modelwidth(15)
